package com.yamaha.bikedesalon.data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;

import android.util.Log;

public class ModelInfo {

	public String Id;
	public int BrandId;
	public String Name;
	public Date UpdateTime;
	public List<String> Pix;

	public ModelInfo() {
	}

	public ModelInfo(JSONObject object) {
		try {

			Id = object.getString("model_id");
			Name = object.getString("name");
			BrandId = object.getInt("brand_id");
			UpdateTime = new Date(object.getLong("update_time"));
			JSONArray temps = object.getJSONArray("pix");

			if (temps.length() > 0) {
				Pix = new ArrayList<String>();
				for (int i = 0; i < temps.length(); i++) {
					Pix.add(temps.getString(i));
				}
			}

		} catch (Exception e) {
			Log.e("ModelInfo Error", e.getMessage(), e);
		}
	}
}
